#!/usr/bin/perl
use warnings;
use strict;
print "Content-type: text/html\n\n";
my $string;
my $user;
foreach my $pair (split(/&/, $ENV{'QUERY_STRING'})){
	my ($key, $val) = split(/=/, $pair);
	if ($key eq "username"){
		$user = $val;
	}
}

open IN, "users/$user";
my ($log, $att, $res, $can, $fav) = <IN>;

print <<END_OF_PRINT;
Statistics for $user:<br><br>

Successful Logins: $log<br>
Attempted Logins: $att<br>
Appointments Made: $res<br>
Appointments Canceled: $can<br>
Favorite Doctor: $fav
END_OF_PRINT
